<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        window.onload = function () {
            showTime();
        }
        function checkTime(i) { //补位处理
            if (i < 10){
                i = "0" + i;
            }
            return i;
        }
        function showTime() {
//            alert(myDate.getFullYear()); //年份
//            alert(myDate.getMonth()+1); //月份
//            alert(myDate.getDate()); //日
            var myDate = new Date();
            var year = myDate.getFullYear();
            var month = myDate.getMonth()+1;
            var date = myDate.getDate();
            var d = myDate.getDay();    //4
            var h = myDate.getHours();  //定义小时
            var m = myDate.getMinutes();  //定义分钟
            var s = myDate.getSeconds();  //定义秒钟
            m = checkTime(m);
            s = checkTime(s);
            //alert(myDate.getDay()); //0-6
            var weekday = new Array(7)
            weekday[0]="星期日"
            weekday[1]="星期一"
            weekday[2]="星期二"
            weekday[3]="星期三"
            weekday[4]="星期四"
            weekday[5]="星期五"
            weekday[6]="星期六"
            document.getElementById('show').innerHTML = year + '年'+month+'月'+date+'日'+weekday[d]+h+':'+m+':'+s;
            setTimeout(showTime,500);
        }
    </script>
</head>
<body>

<div class="content1">
    <div id="show">显示时间的位置</div>
</div>

</body>
</html>